import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts

Rectangle {
    Layout.fillWidth: true
    Layout.fillHeight: true

    TextArea {
        id: basicTextArea
        anchors.fill: parent
        anchors.margins: 20
        placeholderText: "请输入多行文本..."
        wrapMode: TextArea.Wrap

        // 修改：为了突出文本框 - 增加边框
        background: Rectangle {
            color: basicTextArea.enabled ? "white" : "#f5f5f5"
            border.color: basicTextArea.activeFocus ? "#1296FF" : "#c0c0c0"
            border.width: basicTextArea.activeFocus ? 2 : 1
            radius: 4
        }

        onTextChanged: {
            console.log("字符数:", text.length)
        }
    }

    Text {
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        anchors.margins: 30
        text: "字符数: " + basicTextArea.text.length
    }
}
